/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kylingroup.J2SE.Thread;

/**
 *
 * @author kylin
 */
public class TestThread {
    public static void main(String args[]){
        //Runnable r=new MyThread1();
        //Thread th1=new Thread(r);
        //th1.start();
        //r.run();//直接调用run方法是属于方法调用，即当run方法执行完毕，返回之后，才开始执行下面的for循环
        
        MyThread2 th2=new MyThread2();
        th2.start();
        //th2.run();
        
        for(int i=0;i<100;i++){
            System.out.println("Mainthread:"+i);
        }
    }
}

class MyThread1 implements Runnable{

    @Override
    public void run() {
        for(int i=0;i<100;i++){
            System.out.println("Mythread1:"+i);
        }
    }

}

class MyThread2 extends Thread{
    public MyThread2(){}
    public void run(){
        for(int i=0;i<100;i++){
            System.out.println("Mythread2:"+i);
        }
    }
}